import React from 'react';

export class App1 extends React.Component {
  render() {
    return (
      <div>
        <button onClick={() => console.log('类组件按钮1事件处理函数执行')}>
          类组件按钮1
        </button>
      </div>
    );
  }
}

export class App2 extends React.Component {
  // 原型方法
  clickHandler(e) {
    console.log('类组件按钮2事件处理函数执行');
    console.log(e);
  }

  render() {
    return (
      <div>
        <button onClick={this.clickHandler}>类组件按钮2</button>
      </div>
    );
  }
}
